package com.mall.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class RegisterIntegerCeptor implements WebMvcConfigurer {


    @Autowired
    LoginValidateInterceptor loginValidateInterceptor;

    //用于注册拦截器   /*     /manager/*     *.do
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        registry.addInterceptor(loginValidateInterceptor).
                addPathPatterns("/**").
                excludePathPatterns("/UserController/**",
                        "/Index/**",
                        "/OSSFileUploadServlet/**")
                .excludePathPatterns("user/login")
                .excludePathPatterns("user/register")
                .excludePathPatterns("/swagger-resources/**")
                .excludePathPatterns("/swagger-ui.html/**")
                .excludePathPatterns("/webjars/**");


    }
}
